<div class="bigtitle"><?=lang('news_title')?> &gt; <?=lang('label_update')?></div>
<table class='tblcontent' cellspacing='0' cellpadding='0' border='0'>
	<tr>
		<td>
			<?=form_open_multipart(site_url('news/update'),array('name'=>'frm','onsubmit'=>'return f_validate()'),array('hidden_status'=>'','hidden_id'=>$detail->id))?>			
			<table class='tblinputform' cellspacing='1' cellpadding='2' border='0' width='100%'>
				 <? if($show_category==1){?>
                <tr>
					<th width='10%'><?=lang('news_categoryname')?></th>
					<td width='90%'>
						<select name='cbo_category'>
							<option value="0"><?=lang('news_selectcategory')?></option>
							<? for($i=0;$i<count($category);$i++){ ?>
							<option value="<?=$category[$i]->id?>" <?=($detail->categoryid==$category[$i]->id?'selected="selected"':'')?>><?=htmlspecialchars($category[$i]->name)?></option>
							<? } ?>
						</select>
					</td>
				</tr>
                <? } ?>
                <!-- Khi truong hop la tuyen dung -->
				<? if($show_category==0 && $code = 'tuyen_dung'){ ?>
                 <tr style="display:none;"> 
					<th width='10%'><?=lang('news_categoryname')?></th>
					<td width='90%'>
						<select name='cbo_category'>
							<option value="22"></option>
						</select>
					</td>
				</tr>
                <? } ?>
				<? if($show_image==1){?>
                <tr>
					<th><?=lang('news_image')?></th>
					<td>
						<? if(!empty($detail->image)){ ?>
						<img src='<?=base_url().$this->config->item('news_img_path').$detail->image?>' border='0' width='150' /><br/>
						<? } ?>
						<input type="file" name="txt_image" size="20"/>
					</td>
				</tr>
                <? } ?>
				<tr>
					<th><?=lang('news_newstitle')?></th>
					<td><input type='text' name='txt_title' style='width:890px;' maxlength='200' value="<?=htmlspecialchars($detail->title)?>" /></td>
				</tr>
                <? if($show_summary==1){?>
				<tr>
					<th><?=lang('news_summary')?></th>
					<td><textarea name='txt_summary' style='width:890px;height:100px;'><?=htmlspecialchars($detail->summary)?></textarea></td>
				</tr>
                <? } ?>
				<tr>
					<th><?=lang('news_content')?></th>
					<td><?=form_fckeditor('txt_content',$detail->content,500)?></td>
				</tr>
			</table>
			<div class='ctrlbtn'>
				<input type='button' name='btn_save' value='<?=lang('label_save')?>' onclick='return f_validate()'/>	
				<input type='button' name='btn_cancel' value='<?=lang('label_cancel')?>' onclick='javascript:history.back(-1)'/>
			</div>
			<?=form_close()?>
		</td>
	</tr>
</table>
<script type='text/javascript'>
	f_onload();
	function f_onload(){ document.frm.cbo_category.focus();}
	function f_validate(){
		form = document.frm;		
		if( form.cbo_category && form.cbo_category.value==0){
			alert("<?=lang('news_js_selectcategory')?>");
			form.cbo_category.focus();
			return false;
		}
		if(form.txt_title.value==''){
			alert("<?=lang('news_js_inputtitle')?>");
			form.txt_title.focus();
			return false;
		}
		if( form.txt_summary && form.txt_summary.value==''){
			alert("<?=lang('news_js_inputsummary')?>");
			form.txt_summary.focus();
			return false;
		}
		form.submit();
	}
</script>